package com.cyu.invoicing.service.impl;

import com.cyu.invoicing.dao.UserDAO;
import com.cyu.invoicing.model.vo.UserVo;
import com.cyu.invoicing.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 刘
 */
@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserDAO userDAO;

    /**
     * 查询用户
     *
     * @return
     */
    @Override
    public List<UserVo> listUser() {
        return userDAO.listUser();
    }

    /**
     * 更新员工密码信息
     *
     * @param user
     * @return
     */
    @Override
    public int updateUserPassword(UserVo user) {
        userDAO.updateUser(user);
        return 0;
    }

    /**
     * 增加用户
     *
     * @param user
     * @return
     */
    @Override
    public int addUser(UserVo user) {
        try {
            userDAO.insertUser(user);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }
}
